//
//  HotCollectionViewCell.m
//  BeautifulShoppings
//
//  Created by GivenBmli on 16/9/1.
//  Copyright © 2016年 GivenBmli. All rights reserved.
//

#import "HotCollectionViewCell.h"
#import "HotModel.h"
#import "UIImageView+WebCache.h"
#import "MJRefresh.h"

#import "TAMacro.h"

@implementation HotCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
    self  = [super initWithFrame:frame];
    if (self) {
        [self creatSubview:frame];
        
    }
    return self;
}
- (void)setHotModel:(HotModel *)hotModel{
    self.name.text = hotModel.name;
    self.price.text = hotModel.price;
    self.price.textColor =[UIColor redColor];
    self.favorites_count.text = [NSString stringWithFormat:@"%ld",(long)hotModel.favorites_count];
    [self.cover_image_url sd_setImageWithURL:[NSURL URLWithString:hotModel.cover_image_url] placeholderImage:[UIImage imageNamed:@"站位"]];
}
- (void)creatSubview:(CGRect)frame {
    self.cover_image_url = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, WIDTH ,HEIGHT/3*2)];
    [self.contentView addSubview:self.cover_image_url];
    self.name = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH/10, HEIGHT/3 *2.1, WIDTH - WIDTH/10, HEIGHT - HEIGHT/3 *2.5 )];
    self.name.numberOfLines = NO;
    [self.contentView addSubview:self.name];
    self.price = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH / 20, HEIGHT / 10 *9, WIDTH , HEIGHT /10  )];
    [self.contentView addSubview:self.price];
    UIVisualEffectView *visualView = [[UIVisualEffectView alloc]initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight]];
    visualView.frame = CGRectMake(0,HEIGHT - 3 , WIDTH   , 2);
    [self.contentView addSubview:visualView];
    UIVisualEffectView *visualView2 = [[UIVisualEffectView alloc]initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight]];
    visualView2.frame = CGRectMake(0,0, 3, HEIGHT);
    [self.contentView addSubview:visualView2];
    UIVisualEffectView *visualView3 = [[UIVisualEffectView alloc]initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight]];
    visualView3.frame = CGRectMake(WIDTH-3,0, 3, HEIGHT);
    [self.contentView addSubview:visualView3];
}
@end
